Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add some doc examples to lib{green,native} #12073

Closed
wants to merge 1 commit into from

Conversation

alexcrichton
Copy link
Member

"How do I start in libX" is a common question that I've seen, so I figured
putting the examples in as many places as possible is probably a good idea.

//! let config = PoolConfig::new();
//! let mut pool = SchedPool::new(config);
//!
//! // Spawn tasks into the pool of schedulers
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It'd be nice if the relationship between threads, schedulers, tasks, etc were outlined here. I still don't know what they are on libgreen. Additionally, what parallelism one can expect when using libgreen.

@flaper87
Copy link
Contributor

flaper87 commented Feb 7, 2014

cool examples

green::start(argc, argv, proc() {
main();
})
green::start(argc, argv, main)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does coercion bare fn -> proc work? I thought that may've disappeared in @eddyb's env-ptr removal.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's gone for function pointers -> closures or procs but not statically known functions. Too lazy to check at the moment...

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does indeed, I've been using it regularly

fn start(argc: int, argv: **u8) -> int { green::start(argc, argv, main) }

That code is under 80 characters, which is the best part!

"How do I start in libX" is a common question that I've seen, so I figured
putting the examples in as many places as possible is probably a good idea.
@alexcrichton
Copy link
Member Author

r? @cmr, I've added more documentation about the high-level design of libgreen, but I wouldn't exactly consider myself a stellar author.

bors added a commit that referenced this pull request Feb 7, 2014
"How do I start in libX" is a common question that I've seen, so I figured
putting the examples in as many places as possible is probably a good idea.
@bors bors closed this Feb 7, 2014
@alexcrichton alexcrichton deleted the doc-examples branch February 7, 2014 22:17
bors added a commit to rust-lang-ci/rust that referenced this pull request Jul 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants